mono cast

76

mono cast -

@Override
public Mono<Authentication> authenticate(Authentication authentication) {
  return Mono.justOrEmpty(authentication)
      .filter(a -> a instanceof  BearerTokenAuthenticationToken)
      .cast(BearerTokenAuthenticationToken.class)
      .map(BearerTokenAuthenticationToken::getToken)
      .flatMap(this.jwtDecoder::decode)
      .flatMap(this.jwtAuthenticationConverter::convert)
      .cast(Authentication.class)
      .onErrorMap(JwtException.class, this::onError);
}

Comments

Submit
0 Comments